<?php
/**
 * <https://y.st./>
 * Copyright © 2017 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'title' => '<code>package matchbox;</code>',
	'subtitle' => 'Written in <span title="Programming 1">CS 1102</span> of <a href="http://www.uopeople.edu/">University of the People</a>, finalised on 2017-05-17',
	'copyright year' => '2017',
	'body' => <<<END
<h2>Source code:</h2>
<h3>Box.java</h3>
<p>
	(provided by assignment directions)
</p>
<h3>MatchBox.java</h3>
<blockquote>
<pre><code>/*
 * Copyright (C) 2017 Alex Yst
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
 */
package matchbox;

/**
 * A simple volume-/weight-calculation class
 * 
 * @author Alex Yst
 */
public class MatchBox extends Box {
	public double weight;

/**
 * Outputs the dimentions, weight, and volume of the box
 * 
 * The assignment required that calculateWeight() output the calculated weight
 * and the parent&apos;s getVolume() method already outputs the volume. We might as
 * well just delegate to those methods to output their respective parts of our
 * information.
 */
	@Override
	public void getVolume() {
		System.out.println(&quot;width of MatchBox is &quot; + this.width);
		System.out.println(&quot;height of MatchBox is &quot; + this.height);
		System.out.println(&quot;depth of MatchBox is &quot; + this.depth);
		this.calculateWeight();
		super.getVolume();
	}
/**
 * calculateWeight()
 * 
 * This method outputs the weight and sets the weight property to match. It
 * assumes a density of 0.03611.
 */
	public void calculateWeight() {
		this.weight = this.depth * this.height * this.width * 0.03611;
		System.out.println(&quot;weight of MatchBox is &quot; + this.weight);
	}
/**
 * Constructor
 * 
 * I thought I read that in Java, if no constructor was provided, the parent&apos;s
 * constructor would be called. However, NetBeans doesn&apos;t seem to allow that.
 * Either I misread or a constructor must be manually defined in the child
 * class. This constructor simply calls the parent&apos;s constructor, because that
 * constructor does everything we need it to.
 * 
 * @param width The box width
 * @param height The box height
 * @param depth The box depth
 */
	public MatchBox(double width, double height, double depth) {
		super(width, height, depth);
	}
}</code></pre>
</blockquote>
<h3>main.java</h3>
<blockquote>
<pre><code>/*
 * Copyright (C) 2017 Alex Yst
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
 */
package matchbox;

/**
 * Alex Yst&apos;s CS 1102 (Programming 1) Unit 6 submission
 * 
 * For this assignment, we were required to define MatchBox.getVolume() to
 * output all the statistics. What this means is that for the main() method of
 * this class to output all the statistics, all we have to do is have it call
 * the other class&apos; getVolume() method. We have to create a new instance of the
 * MatchBox class for this, but we don&apos;t even have to store it in a variable.
 * All we have to do is call the getVolume() method of our new object and we&apos;re
 * done. A simple one-liner will sufice.
 * 
 * @author Alex Yst
 */
public class main {
	public static void main(String[] arguments) {
		new MatchBox(5, 10, 3).getVolume();
	}
}</code></pre>
</blockquote>
<h2>Output:</h2>
<blockquote>
<pre>run:
width of MatchBox is 5.0
height of MatchBox is 10.0
depth of MatchBox is 3.0
weight of MatchBox is 5.4165
Volume is : 150.0
BUILD SUCCESSFUL (total time: 0 seconds)</pre>
</blockquote>
END
);
